package com.cip.admin.dao.impl;

import java.util.List;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.cip.admin.dao.EmailDAO;
import com.cip.admin.model.EmailConfig;

public class EmailDAOImpl extends CipHibernateDAOSupport implements EmailDAO{

	public List<EmailConfig> getAllEmaillConfigList() throws Exception {
		HibernateTemplate hibernateTemplate = getCipHibernateTemplate();		
	    List<EmailConfig> configList = hibernateTemplate.loadAll(EmailConfig.class);
		return configList;
	}

	public EmailConfig getEmailConfigById(int id) throws Exception {
		HibernateTemplate hibernateTemplate = getHibernateTemplate();
		 return hibernateTemplate.get(EmailConfig.class, id);
	}

	public EmailConfig  saveOrUpdateEmailConfig(EmailConfig emailConfig) throws Exception {
		getHibernateTemplate().saveOrUpdate(emailConfig);
		return emailConfig;
	}

	public EmailConfig  editEmailConfig(EmailConfig emailConfig) throws Exception {
		getHibernateTemplate().update(emailConfig); 
		return emailConfig;
	}
}
